{include file="public/header"/}
<link rel="stylesheet" href="{__PUBLIC_PATH}/admin/pcf/pcfcms.css?v={$version}"/>
<script src="{__PUBLIC_PATH}/common/js/jquery.js?v={$version}"></script>
<script src="{__PUBLIC_PATH}/admin/pcf/global.js?v={$version}"></script>
</head>
<body>
<div class="layui-form">
<div class="layui-fluid" style="padding-bottom:83px;border:0;">
<div class="layui-col-sm12">
<div class="layui-card" style="box-shadow:0 0 0 0;">
  <div class="layui-tab layui-tab-brief" id="pcfsystem">
    <ul class="layui-tab-title" style="background-color:#f2f2f2;">
        <a href="{:url('/system.web/index')}"><li class="layui-this">网站设置</li></a>
        <a href="{:url('/system.web/web2')}"><li>核心设置</li></a>
        <a href="{:url('/system.web/basic')}"><li>附件设置</li></a>
        <a href="{:url('/system.web/weapp_email')}"><li>邮箱配置</li></a>
        <a href="{:url('/system.web/weapp_sms')}"><li>短信配置</li></a>
        <a href="{:url('/system.web/weapp_pay')}" style="display:none;"><li>支付配置</li></a>
        <a href="{:url('/system.web/weapp_social')}" style="display:none;"><li>第三方登录配置</li></a>
    </ul>
    <div class="layui-tab-content">
      <div class="layui-tab-item layui-show">
          <div class="layui-form-item">
            <label class="layui-form-label">网站状态</label>
            <div class="layui-input-block">
              <input type="checkbox" lay-filter="web_status" lay-skin="switch" lay-text="开启|关闭" {if condition="!isset($config.web_status) OR $config.web_status eq 1"}checked{/if}>
              <input type="hidden" name="web_status" value="{$config.web_status|default='0'}" />
            </div>
          </div>
          <div class="layui-form-item" style="margin-bottom:5px;">
            <label class="layui-form-label">网站简称</label>
            <div class="layui-input-inline">
              <input type="text" id="web_name" name="web_name" value="{$config.web_name|default=''}" placeholder="即在后台显示的名称" autocomplete="off" class="layui-input" data-num="50">
            </div>
            <div class="layui-input-inline auto gray">即在后台显示的名称<br>引用变量：<code>web_name</code></div>
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label"></label>
            <div class="layui-input-inline auto gray" style="color:#009688;">一般不超过50个字符</div>
          </div>
          <div class="layui-form-item" style="margin-bottom:5px;">
            <label class="layui-form-label">网站LOGO</label>
            <div class="layui-input-inline default-auto">
              <ul class="layout">
                <li>
                <input name="web_logo" id="web_logo" placeholder="图片地址" value="{$config.web_logo|default=''}" class="layui-input inp inp_logo">
                <input type="hidden" name="old_web_logo" value="{$config.web_logo|default=''}">
                <img id="img_web_logo" src="{$config.web_logo|get_default_pic=###}?v={php}echo time();{/php}" class="pcfdisplay">
                </li>
                <li style="margin-top:3px;">
                  <div class="layui-btn-group">
                    <input type="button" value="上传图片" class="layui-btn layui-btn-sm test-upload-demoMore" lay-data="{number:1,ey_inputId:'web_logo',ey_savepath:'allimg'}">
                    <input type="button" value="选择图片" class="layui-btn layui-btn-sm" onClick="GetPictureFolder(1,'web_logo');">
                    <input type="button" value="预览" class="layui-btn layui-btn-sm" onclick="BigImages($('#img_web_logo').attr('src'));">
                    <input type="button" value="清除" class="layui-btn layui-btn-sm layui-btn-warm" data-inputid="web_logo" onclick="DelImages(this);">
                  </div>
                </li>
              </ul>
            </div>
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label"></label>
            <div class="layui-input-inline auto gray" style="color:#009688;">默认网站LOGO，通用头部显示，显示尺寸以模板设计为主</div>
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label">地址图标</label>
            <div class="layui-input-inline default-auto">
            <ul class="layout">
              <li style="width:32px;">
              <img id="img_web_ico" src="{$config.web_ico}?v={php}echo time();{/php}" width="32" height="32">
              <input type="hidden" name="web_ico" id="web_ico" placeholder="图片地址" value="{$config.web_ico|default=''}">
              </li>
              <li style="margin-top:3px;">
                <div class="layui-btn-group">
                  <input type="button" value="上传图片" class="layui-btn layui-btn-sm test-upload-demoMore" lay-data="{number:1,exts:'ico',ey_inputId:'web_ico',ey_savepath:'allimg'}">
                </div>
              </li>
            </ul>
			<div class="layui-input-inline auto gray lh38" style="color:#009688;">建议尺寸 32 * 32 (像素) 的.ico文件; 如果无法正常显示新上传图标，清空浏览器缓存后访问。</div>
            </div>
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label">网站域名</label>
            <div class="layui-input-inline">
              <input type="text" name="web_basehost" value="{$config.web_basehost|default=''}" placeholder="{$Request.scheme}://" class="layui-input">
            </div>
            <div class="layui-input-inline auto gray lh38">引用变量：<code>web_basehost</code></div>
          </div>
          <div class="layui-form-item" style="margin-bottom:5px;">
            <label class="layui-form-label">首页标题</label>
            <div class="layui-input-inline">
              <input type="text" id="web_title" name="web_title" lay-verify="title" placeholder="一般不超过80个字符" value="{$config.web_title|default=''}" class="layui-input" data-num="80">
            </div>
            <div class="layui-input-inline auto gray lh38">引用变量：<code>web_title</code></div>
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label"></label>
            <div class="layui-input-inline auto gray" style="color:#009688;">一般不超过80个字符</div>
          </div>
          <div class="layui-form-item" style="margin-bottom:5px;">
            <label class="layui-form-label">首页关键词</label>
            <div class="layui-input-inline">
              <input type="text" name="web_keywords" lay-verify="title" value="{$config.web_keywords|default=''}" placeholder="一般不超过100个字符" class="layui-input" data-num="100">
            </div>
            <div class="layui-input-inline auto gray lh38">引用变量：<code>web_keywords</code></div>
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label"></label>
            <div class="layui-input-inline auto gray" style="color:#009688;">一般不超过100个字符</div>
          </div>
          <div class="layui-form-item layui-form-text" style="margin-bottom:5px;">
            <label class="layui-form-label">首页描述</label>
            <div class="layui-input-inline">
              <textarea id="web_description" name="web_description" class="layui-textarea" placeholder="建议不超过200个字符" data-num="200">{$config.web_description|default=''}</textarea>
            </div>
            <div class="layui-input-inline auto gray lh38">引用变量：<code>web_description</code></div>
          </div>
          <div class="layui-form-item">
            <label class="layui-form-label"></label>
            <div class="layui-input-inline auto gray" style="color:#009688;">一般不超过200个字符</div>
          </div>
          <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">版权信息</label>
            <div class="layui-input-inline">
              <textarea name="web_copyright" class="layui-textarea">{$config.web_copyright|default=''}</textarea>
            </div>
            <div class="layui-input-inline auto gray lh38">引用变量：<code>web_copyright</code></div>
          </div>
           <div class="layui-form-item">
            <label class="layui-form-label">备案号</label>
            <div class="layui-input-inline">
              <input type="text" name="web_recordnum" lay-verify="title" value="{$config.web_recordnum|default=''}" class="layui-input">
            </div>
            <div class="layui-input-inline auto gray lh38">引用变量：<code>web_recordnum</code></div>
          </div>
      </div>
    </div>
    <div class="pcfline"></div>
    <div class="layui-tab-content">
      <div class="layui-tab-item layui-show"> 
          <div class="layui-form-item">
            <label class="layui-form-label"><strong>第三方代码</strong></label>
            <div class="layui-input-inline"></div>
          </div>
          <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">电脑PC端</label>
            <div class="layui-input-inline">
              <textarea name="web_thirdcode_pc" id="web_thirdcode_pc" class="layui-textarea">{$config.web_thirdcode_pc|default=''}</textarea>
            </div>
            <div class="layui-input-inline auto gray lh38">引用变量：<code>web_thirdcode_pc</code></div>
          </div>
          <div class="layui-form-item layui-form-text">
            <label class="layui-form-label">手机移动端</label>
            <div class="layui-input-inline">
              <textarea name="web_thirdcode_wap" id="web_thirdcode_wap" class="layui-textarea">{$config.web_thirdcode_wap|default=''}</textarea>
            </div>
            <div class="layui-input-inline auto gray lh38">引用变量：<code>web_thirdcode_wap</code></div>
          </div>
      </div>
    </div>
    <div class="pcfline"></div>
    <div class="layui-tab-content">
      <div class="layui-tab-item layui-show"> 
        <div class="layui-form-item">
          <label class="layui-form-label"><strong>自定义变量</strong></label>
          <div class="layui-input-inline layadmin-layer-demo">
            <button class="layui-btn layui-btn-sm" data-type="customvar_index">管理</button>
          </div>
        </div>
        {volist name="pcf_row" id="vo"}
        <div class="layui-form-item" id="dl_{$vo['attr_var_name']}">
          <label class="layui-form-label">{$vo['attr_name']}</label>
          {switch name="$vo['attr_input_type']" }
            {case value="1"}
            {/case}
            {case value="2"}
            <div class="layui-input-inline">
              <textarea name="{$vo['attr_var_name']}" id="{$vo['attr_var_name']}" class="layui-textarea">{$vo.value|default=''}</textarea>
            </div>
            {/case}
            {case value="3"}
            <div class="layui-input-inline default-auto">
            <ul class="layout">
              <li>
              <input type="text" class="layui-input inp inp_logo" name="{$vo['attr_var_name']}" id="{$vo['attr_var_name']}" placeholder="图片地址" value="{$vo.value|default=''}">
              <img id="img_{$vo['attr_var_name']}" src="{$vo.value|get_default_pic=###}" class="pcfdisplay">
              </li>
              <li style="margin-top:3px;">
                <div class="layui-btn-group">
                  <input type="button" value="上传图片" class="layui-btn layui-btn-sm test-upload-demoMore" lay-data="{number:1,ey_inputId:'{$vo['attr_var_name']}',ey_savepath:'allimg'}">
                  <input type="button" value="选择图片" class="layui-btn layui-btn-sm" onClick="GetPictureFolder(1,'{$vo['attr_var_name']}');">
                  <input type="button" value="预览" class="layui-btn layui-btn-sm" onclick="BigImages($('#img_{$vo['attr_var_name']}').attr('src'));">
                  <input type="button" value="清除" class="layui-btn layui-btn-sm layui-btn-warm" data-inputid="{$vo['attr_var_name']}" onclick="DelImages(this);">
                </div>
              </li>
            </ul>
            </div>
            {/case}
            {default/}
            <div class="layui-input-inline">
              <input type="text" id="{$vo['attr_var_name']}" name="{$vo['attr_var_name']}" value="{$vo.value|default=''}" lay-verify="title" class="layui-input">
            </div>
          {/switch}
        </div>
        {/volist}
      </div>
    </div>
  </div>
</div>
</div>
<div class="submit-info text-center">
    <button class="layui-btn" lay-submit lay-filter="formSubmit">确认提交</button>
</div>
<div class="pcfclear"></div>
</div>
</div>
{include file="public/footer"/}
<script type="text/javascript">
    layui.use(['layer', 'form', 'element', 'admin'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        var element = layui.element;
        var admin = layui.admin;
        //触发事件
        var active = {
          customvar_index: function(){
            layer.open({
                type: 2,
                title: '自定义变量列表',
                fixed: true,
                shadeClose: false,
                shade: 0.3,
                area: ['100%', '100%'],
                content: "{:url('/system.web/customvar_index')}",
                end: function(){
                  window.location.reload();
                }
            });
          }
        };
        $('#pcfsystem .layui-btn').on('click', function(){
          var type = $(this).data('type');
          active[type] && active[type].call(this);
        });
        // 监听开关
        form.on('switch', function(data){
          var elemId = data.elem.attributes['lay-filter']['nodeValue'];
          if (data.elem.checked) {
            this.value = 1;
          } else {
            this.value = 0;
          }
          $("input[name='"+elemId+"']").val(this.value);
        });
        //监听提交
        form.on('submit(formSubmit)', function(data){
            layer.load(2);
            $.ajax({
                type : 'post',
                url : "{:url('/system.web/index')}",
                data : data.field,
                dataType : 'json',
                success : function(res){
                    layer.closeAll('loading');
                    if(res.status){
                        layer.msg(res.msg, {icon: 1, time: 1000}, function(){
                            window.location.reload();
                        });
                    }else{
                      layer.msg(res.msg, {icon: 2, time: 1000});
                    }
                },
                error: function(e){
                    layer.closeAll('loading');
                    layer.msg("未知错误，操作中断！", {icon: 2, time: 1000});
                }
            });
            return false;
        });
  });
</script>
</body>
</html>